package ygg.encoding.swf.tag
{
	import j.sus2maj7.encoding.*;
	import j.sus2maj7.context.*;
	
	import ygg.encoding.swf.tag.object.*;
	import ygg.encoding.swf.tag.codec.*;
	
	public class TagCodecFactory extends AbstractCodecFactory
	{
		override public function getDecoder(o:*, context:IContext = null):ICodec
		{
			var retVal:ICodec;
			
			var type:uint = o as uint;
			switch (type)
			{
				case TagType.END:
					retVal = new EndCodec();		//00
					break;
				case TagType.SHOW_FRAME:
					retVal = new ShowFrameCodec();		//01
					break;
				case TagType.DEFINE_SHAPE:
					retVal = new DefineShapeCodec();		//02
					break;
				case TagType.FREE_CHARACTER:
					retVal = new FreeCharacterCodec();		//03 not in spec
					break;
				case TagType.PLACE_OBJECT:
					retVal = new PlaceObjectCodec();		//04
					break;
				case TagType.REMOVE_OBJECT:
					retVal = new RemoveObjectCodec();		//05
					break;
				case TagType.DEFINE_BITS:
					retVal = new DefineBitsCodec();		//06
					break;
				case TagType.DEFINE_BUTTON:
					retVal = new DefineButtonCodec();		//07
					break;
				case TagType.JPEGTABLES:
					retVal = new JPEGTablesCodec();		//08
					break;
				case TagType.SET_BACKGROUND_COLOR:
					retVal = new SetBackgroundColorCodec();		//09
					break;
				case TagType.DEFINE_FONT:
					retVal = new DefineFontCodec();		//10
					break;
				case TagType.DEFINE_TEXT:
					retVal = new DefineTextCodec();		//11
					break;
				case TagType.DO_ACTION:
					retVal = new DoActionCodec();		//12
					break;
				case TagType.DEFINE_FONT_INFO:
					retVal = new DefineFontInfoCodec();		//13
					break;
				case TagType.DEFINE_SOUND:
					retVal = new DefineSoundCodec();		//14
					break;
				case TagType.START_SOUND:
					retVal = new StartSoundCodec();		//15
					break;
				case TagType.STOP_SOUND:
					retVal = new StopSoundCodec();		//16 not in spec
					break;
				case TagType.DEFINE_BUTTON_SOUND:
					retVal = new DefineButtonSoundCodec();		//17
					break;
				case TagType.SOUND_STREAM_HEAD:
					retVal = new SoundStreamHeadCodec();		//18
					break;
				case TagType.SOUND_STREAM_BLOCK:
					retVal = new SoundStreamBlockCodec();		//19
					break;
				case TagType.DEFINE_BITS_LOSSLESS:
					retVal = new DefineBitsLosslessCodec();		//20
					break;
				case TagType.DEFINE_BITS_JPEG_2:
					retVal = new DefineBitsJPEG2Codec();		//21
					break;
				case TagType.DEFINE_SHAPE_2:
					retVal = new DefineShape2Codec();		//22
					break;
				case TagType.DEFINE_BUTTON_CXFORM:
					retVal = new DefineButtonCxformCodec();		//23
					break;
				case TagType.PROTECT:
					retVal = new ProtectCodec();		//24
					break;
				case TagType.PATHS_ARE_POST_SCRIPT:
					retVal = new PathsArePostScriptCodec();		//25 not in spec
					break;
				case TagType.PLACE_OBJECT_2:
					retVal = new PlaceObject2Codec();		//26
					break;
				case TagType.REMOVE_OBJECT_2:
					retVal = new RemoveObject2Codec();		//28
					break;
				case TagType.SYNC_FRAME:
					retVal = new SyncFrameCodec();		//29 not in spec
					break;
				case TagType.FREE_ALL:
					retVal = new FreeAllCodec();		//31 not in spec
					break;
				case TagType.DEFINE_SHAPE_3:
					retVal = new DefineShape3Codec();		//32
					break;
				case TagType.DEFINE_TEXT_2:
					retVal = new DefineText2Codec();		//33
					break;
				case TagType.DEFINE_BUTTON_2:
					retVal = new DefineButton2Codec();		//34
					break;
				case TagType.DEFINE_BITS_JPEG_3:
					retVal = new DefineBitsJPEG3Codec();		//35
					break;
				case TagType.DEFINE_BITS_LOSSLESS_2:
					retVal = new DefineBitsLossless2Codec();		//36
					break;
				case TagType.DEFINE_EDIT_TEXT:
					retVal = new DefineEditTextCodec();		//37
					break;
				case TagType.DEFINE_VIDEO:
					retVal = new DefineVideoCodec();		//38 not in spec
					break;
				case TagType.DEFINE_SPRITE:
					retVal = new DefineSpriteCodec();		//39
					break;
				case TagType.NAME_CHARACTER:
					retVal = new NameCharacterCodec();		//40 not in spec
					break;
				case TagType.PRODUCT_INFO:
					retVal = new ProductInfoCodec();		//41 not in spec
					break;
				case TagType.DEFINE_TEXT_FORMAT:
					retVal = new DefineTextFormatCodec();		//42 not in spec
					break;
				case TagType.FRAME_LABEL:
					retVal = new FrameLabelCodec();		//43
					break;
				case TagType.DEFINE_BEHAVIOR:
					retVal = new DefineBehaviorCodec();		//44 not in spec
					break;
				case TagType.SOUND_STREAM_HEAD_2:
					retVal = new SoundStreamHead2Codec();		//45
					break;
				case TagType.DEFINE_MORPH_SHAPE:
					retVal = new DefineMorphShapeCodec();		//46
					break;
				case TagType.FRAME_TAG:
					retVal = new FrameTagCodec();		//47 not in spec
					break;
				case TagType.DEFINE_FONT_2:
					retVal = new DefineFont2Codec();		//48
					break;
				case TagType.GEN_COMMAND:
					retVal = new GenCommandCodec();		//49 not in spec
					break;
				case TagType.DEFINE_COMMAND_OBJ:
					retVal = new DefineCommandObjCodec();		//50 not in spec
					break;
				case TagType.CHARACTER_SET:
					retVal = new CharacterSetCodec();		//51 not in spec
					break;
				case TagType.FONT_REF:
					retVal = new FontRefCodec();		//52 not in spec
					break;
				case TagType.DEFINE_FUNCTION:
					retVal = new DefineFunctionCodec();		//53 not in spec
					break;
				case TagType.PLACE_FUNCTION:
					retVal = new PlaceFunctionCodec();		//54 not in spec
					break;
				case TagType.GEN_TAG_OBJECT:
					retVal = new GenTagObjectCodec();		//55 not in spec
					break;
				case TagType.EXPORT_ASSETS:
					retVal = new ExportAssetsCodec();		//56
					break;
				case TagType.IMPORT_ASSETS:
					retVal = new ImportAssetsCodec();		//57
					break;
				case TagType.ENABLE_DEBUGGER:
					retVal = new EnableDebuggerCodec();		//58
					break;
				case TagType.DO_INIT_ACTION:
					retVal = new DoInitActionCodec();		//59
					break;
				case TagType.DEFINE_VIDEO_STREAM:
					retVal = new DefineVideoStreamCodec();		//60
					break;
				case TagType.VIDEO_FRAME:
					retVal = new VideoFrameCodec();		//61
					break;
				case TagType.DEFINE_FONT_INFO_2:
					retVal = new DefineFontInfo2Codec();		//62
					break;
				case TagType.DEBUG_ID:
					retVal = new DebugIDCodec();		//63 not in spec
					break;
				case TagType.ENABLE_DEBUGGER_2:
					retVal = new EnableDebugger2Codec();		//64
					break;
				case TagType.SCRIPT_LIMITS:
					retVal = new ScriptLimitsCodec();		//65
					break;
				case TagType.SET_TAB_INDEX:
					retVal = new SetTabIndexCodec();		//66
					break;
				case TagType.FILE_ATTRIBUTES:
					retVal = new FileAttributesCodec();		//69
					break;
				case TagType.PLACE_OBJECT_3:
					retVal = new PlaceObject3Codec();		//70
					break;
				case TagType.IMPORT_ASSETS_2:
					retVal = new ImportAssets2Codec();		//71
					break;
				case TagType.DO_ABC:
					retVal = new DoABCCodec();		//72 not in spec
					break;
				case TagType.DEFINE_FONT_ALIGN_ZONES:
					retVal = new DefineFontAlignZonesCodec();		//73
					break;
				case TagType.CSMTEXT_SETTINGS:
					retVal = new CSMTextSettingsCodec();		//74
					break;
				case TagType.DEFINE_FONT_3:
					retVal = new DefineFont3Codec();		//75
					break;
				case TagType.SYMBOL_CLASS:
					retVal = new SymbolClassCodec();		//76
					break;
				case TagType.METADATA:
					retVal = new MetadataCodec();		//77
					break;
				case TagType.DEFINE_SCALING_GRID:
					retVal = new DefineScalingGridCodec();		//78
					break;
				case TagType.DO_ABC_2:
					retVal = new DoABC2Codec();		//82
					break;
				case TagType.DEFINE_SHAPE_4:
					retVal = new DefineShape4Codec();		//83
					break;
				case TagType.DEFINE_MORPH_SHAPE_2:
					retVal = new DefineMorphShape2Codec();		//84
					break;
				case TagType.DEFINE_SCENE_AND_FRAME_LABEL_DATA:
					retVal = new DefineSceneAndFrameLabelDataCodec();		//86
					break;
				case TagType.DEFINE_BINARY_DATA:
					retVal = new DefineBinaryDataCodec();		//87
					break;
				case TagType.DEFINE_FONT_NAME:
					retVal = new DefineFontNameCodec();		//88
					break;
				case TagType.START_SOUND_2:
					retVal = new StartSound2Codec();		//89
					break;
				case TagType.DEFINE_BITS_JPEG_4:
					retVal = new DefineBitsJPEG4Codec();		//90
					break;
				case TagType.DEFINE_FONT_4:
					retVal = new DefineFont4Codec();		//91
				default:
			}
			
			return retVal;
		}
		
		override public function getEncoder(o:*, context:IContext = null):ICodec
		{
			return null;
		}
		
		public function TagCodecFactory()
		{
			super();
		}

	}
}